home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / pattern.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  40.7 KB  |  1,021 lines

  1. *pattern.txt*   For Vim version 6.0.  Last change: 2001 Sep 16
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Patterns and search commands                *pattern-searches*
  8.  
  9. The very basics can be found in section |03.9| of the user manual.  A few more
  10. explanations are in chapter 27 |usr_27.txt|.
  11.  
  12. 1. Search commands        |search-commands|
  13. 2. The definition of a pattern    |search-pattern|
  14. 3. Highlighting matches        |match-highlight|
  15.  
  16. ==============================================================================
  17. 1. Search commands                    *search-commands*
  18.  
  19.                             */*
  20. /{pattern}[/]<CR>    Search forward for the [count]'th occurrence of
  21.             {pattern} (exclusive).
  22.  
  23. /{pattern}/{offset}<CR>    Search forward for the [count]'th occurrence of
  24.             {pattern} and go |{offset}| lines up or down.
  25.             (linewise).
  26.  
  27.                             */<CR>*
  28. /<CR>            Search forward for the [count]'th latest used
  29.             pattern |last-pattern| with latest used |{offset}|.
  30.  
  31. //{offset}<CR>        Search forward for the [count]'th latest used
  32.             pattern |last-pattern| with new |{offset}|.  If
  33.             {offset} is empty no offset is used.
  34.  
  35.                             *?*
  36. ?{pattern}[?]<CR>    Search backward for the [count]'th previous
  37.             occurrence of {pattern} (exclusive).
  38.  
  39. ?{pattern}?{offset}<CR>    Search backward for the [count]'th previous
  40.             occurrence of {pattern} and go |{offset}| lines up or
  41.             down (linewise).
  42.  
  43.                             *?<CR>*
  44. ?<CR>            Search backward for the [count]'th latest used
  45.             pattern |last-pattern| with latest used |{offset}|.
  46.  
  47. ??{offset}<CR>        Search backward for the [count]'th latest used
  48.             pattern |last-pattern| with new |{offset}|.  If
  49.             {offset} is empty no offset is used.
  50.  
  51.                             *n*
  52. n            Repeat the latest "/" or "?" [count] times.
  53.             |last-pattern| {Vi: no count}
  54.  
  55.                             *N*
  56. N            Repeat the latest "/" or "?" [count] times in
  57.             opposite direction. |last-pattern| {Vi: no count}
  58.  
  59.                             *star* *E348* *E349*
  60. *            Search forward for the [count]'th occurrence of the
  61.             word nearest to the cursor.  The word used for the
  62.             search is the first of:
  63.                 1. the keyword under the cursor |'iskeyword'|
  64.                 2. the first keyword after the cursor, in the
  65.                    current line
  66.                 3. the non-blank word under the cursor
  67.                 4. the first non-blank word after the cursor,
  68.                    in the current line
  69.             Only whole keywords are searched for, like with the
  70.             command "/\<keyword\>".  (exclusive)  {not in Vi}
  71.  
  72.                             *#*
  73. #            Same as "*", but search backward.  The pound sign
  74.             (character 163) also works.  If the "#" key works as
  75.             backspace, try using "stty erase <BS>" before starting
  76.             Vim (<BS> is CTRL-H or a real backspace).  {not in Vi}
  77.  
  78.                             *gstar*
  79. g*            Like "*", but don't put "\<" and "\>" around the word.
  80.             This makes the search also find matches that are not a
  81.             whole word.  {not in Vi}
  82.  
  83.                             *g#*
  84. g#            Like "#", but don't put "\<" and "\>" around the word.
  85.             This makes the search also find matches that are not a
  86.             whole word.  {not in Vi}
  87.  
  88.                             *gd*
  89. gd            Goto local Declaration.  When the cursor is on a local
  90.             variable, this command will jump to its declaration.
  91.             First Vim searches for the start of the current
  92.             function, just like "[[".  If it is not found the
  93.             search stops in line 1.  If it is found, Vim goes back
  94.             until a blank line is found.  From this position Vim
  95.             searches for the keyword under the cursor, like with
  96.             "*", but lines that look like a comment are ignored
  97.             (see 'comments' option).
  98.             Note that this is not guaranteed to work, Vim does not
  99.             really check the syntax, it only searches for a match
  100.             with the keyword.  If included files also need to be
  101.             searched use the commands listed in |include-search|.
  102.             {not in Vi}
  103.  
  104.                             *gD*
  105. gD            Goto global Declaration.  When the cursor is on a
  106.             global variable that is defined in the file, this
  107.             command will jump to its declaration.  This works just
  108.             like "gd", except that the search for the keyword
  109.             always starts in line 1.  {not in Vi}
  110.  
  111.                             *CTRL-C*
  112. CTRL-C            Interrupt current (search) command.  Use CTRL-Break on
  113.             MS-DOS |dos-CTRL-Break|.
  114.             In Normal mode, any pending command is aborted.
  115.  
  116.                             *:noh* *:nohlsearch*
  117. :noh[lsearch]        Stop the highlighting for the 'hlsearch' option.  It
  118.             is automatically turned back on when using a search
  119.             command, or setting the 'hlsearch' option.
  120.             This command doesn't work in an autocommand, because
  121.             the highlighting state is saved and restored when
  122.             executing autocommands |autocmd-searchpat|.
  123.  
  124. While typing the search pattern the current match will be shown if the
  125. 'incsearch' option is on.  Remember that you still have to finish the search
  126. command with <CR> to actually position the cursor at the displayed match.  Or
  127. use <Esc> to abandon the search.
  128.  
  129. All matches for the last used search pattern will be highlighted if you set
  130. the 'hlsearch' option.  This can be suspended with the |:nohlsearch| command.
  131.  
  132.                     *search-offset* *{offset}*
  133. These commands search for the specified pattern.  With "/" and "?" an
  134. additional offset may be given.  There are two types of offsets: line offsets
  135. and character offsets.  {the character offsets are not in Vi}
  136.  
  137. The offset gives the cursor position relative to the found match:
  138.     [num]    [num] lines downwards, in column 1
  139.     +[num]    [num] lines downwards, in column 1
  140.     -[num]    [num] lines upwards, in column 1
  141.     e[+num]    [num] characters to the right of the end of the match
  142.     e[-num]    [num] characters to the left of the end of the match
  143.     s[+num]    [num] characters to the right of the start of the match
  144.     s[-num]    [num] characters to the left of the start of the match
  145.     b[+num]    [num] characters to the right of the start (begin) of the match
  146.     b[-num]    [num] characters to the left of the start (begin) of the match
  147.  
  148. If a '-' or '+' is given but [num] is omitted, a count of one will be used.
  149. When including an offset with 'e', the search becomes inclusive (the
  150. character the cursor lands on is included in operations).
  151.  
  152. Examples:
  153.  
  154. pattern            cursor position    ~
  155. /test/+1        one line below "test", in column 1
  156. /test/e            on the last t of "test"
  157. /test/s+2        on the 's' of "test"
  158. /test/b-3        three characters before "test"
  159.  
  160. If one of these commands is used after an operator, the characters between
  161. the cursor position before and after the search is affected.  However, if a
  162. line offset is given, the whole lines between the two cursor positions are
  163. affected.
  164.  
  165. An example of how to search for matches with a pattern and change the match
  166. with another word: >
  167.     /foo<CR>    find "foo"
  168.     c//e        change until end of match
  169.     bar<Esc>    type replacement
  170.     //<CR>        go to start of next match
  171.     c//e        change until end of match
  172.     beep<Esc>    type another replacement
  173.             etc.
  174. <
  175.                             *//;* *E386*
  176. A very special offset is ';' followed by another search command.  For example: >
  177.  
  178.    /test 1/;/test
  179.    /test.*/+1;?ing?
  180.  
  181. The first one first finds the next occurrence of "test 1", and then the first
  182. occurrence of "test" after that.
  183.  
  184. This is like executing two search commands after each other, except that:
  185. - It can be used as a single motion command after an operator.
  186. - The direction for a following "n" or "N" command comes from the first
  187.   search command.
  188. - When an error occurs the cursor is not moved at all.
  189.  
  190.                             *last-pattern*
  191. The last used pattern and offset are remembered.  They can be used to repeat
  192. the search, possibly in another direction or with another count.  Note that
  193. two patterns are remembered: One for 'normal' search commands and one for the
  194. substitute command ":s".  Each time an empty pattern is given, the previously
  195. used pattern is used.
  196.  
  197. The 'magic' option sticks with the last used pattern.  If you change 'magic',
  198. this will not change how the last used pattern will be interpreted.
  199. The 'ignorecase' option does not do this.  When 'ignorecase' is changed, it
  200. will result in the pattern to match other text.
  201.  
  202. All matches for the last used search pattern will be highlighted if you set
  203. the 'hlsearch' option.
  204.  
  205. To clear the last used search pattern: >
  206.     :let @/ = ""
  207. This will not set the pattern to an empty string, because that would match
  208. everywhere.  The pattern is really cleared, like when starting Vim.
  209.  
  210. In Vi the ":tag" command sets the last search pattern when the tag is searched
  211. for.  In Vim this is not done, the previous search pattern is still remembered,
  212. unless the 't' flag is present in 'cpoptions'.  The search pattern is always
  213. put in the search history.
  214.  
  215. If the 'wrapscan' option is on (which is the default), searches wrap around
  216. the end of the buffer.  If 'wrapscan' is not set, the backward search stops
  217. at the beginning and the forward search stops at the end of the buffer.  If
  218. 'wrapscan' is set and the pattern was not found the error message "pattern
  219. not found" is given, and the cursor will not be moved.  If 'wrapscan' is not
  220. set the message becomes "search hit BOTTOM without match" when searching
  221. forward, or "search hit TOP without match" when searching backward.  If
  222. wrapscan is set and the search wraps around the end of the file the message
  223. "search hit TOP, continuing at BOTTOM" or "search hit BOTTOM, continuing at
  224. TOP" is given when searching backwards or forwards respectively.  This can be
  225. switched off by setting the 's' flag in the 'shortmess' option.  The highlight
  226. method 'w' is used for this message (default: standout).
  227.  
  228.                             *search-range*
  229. You cannot limit the search command "/" to a certain range of lines.  A trick
  230. to do this anyway is to use the ":substitute" command with the 'c' flag.
  231. Example: >
  232.    :.,300s/Pattern//gc
  233. This command will search from the cursor position until line 300 for
  234. "Pattern".  At the match, you will be asked to type a character.  Type 'q' to
  235. stop at this match, type 'n' to find the next match.
  236.  
  237. The "*", "#", "g*" and "g#" commands look for a word near the cursor in this
  238. order, the first one that is found is used:
  239. - The keyword currently under the cursor.
  240. - The first keyword to the right of the cursor, in the same line.
  241. - The WORD currently under the cursor.
  242. - The first WORD to the right of the cursor, in the same line.
  243. The keyword may only contain letters and characters in 'iskeyword'.
  244. The WORD may contain any non-blanks (<Tab>s and/or <Space>s).
  245. Note that if you type with ten fingers, the characters are easy to remember:
  246. the "#" is under your left hand middle finger (search to the left and up) and
  247. the "*" is under your right hand middle finger (search to the right and down).
  248. (this depends on your keyboard layout though).
  249.  
  250. ==============================================================================
  251. 2. The definition of a pattern        *search-pattern* *pattern* *[pattern]*
  252.                     *regular-expression* *regexp* *Pattern*
  253.                     *E76* *E361* *E363* *E383*
  254.  
  255. For starters, read chapter 27 of the user manual |usr_27.txt|.
  256.  
  257.                         */bar* */\bar* */pattern*
  258. 1. A pattern is one or more branches, separated by "\|".  It matches anything
  259.    that matches one of the branches.  Example: "foo\|beep" matches "foo" and
  260.    matches "beep".  If more than one branch matches, the first one is used.
  261.  
  262.    pattern ::=        branch
  263.         or  branch \| branch
  264.         or  branch \| branch \| branch
  265.         etc.
  266.  
  267.                         */branch* */\&*
  268. 2. A branch is one or more concats, separated by "\&".  It matches the last
  269.    concat, but only if all the preceding concats also match at the same
  270.    position.  Example: "foobeep\&..." matches "foo" in "foobeep".
  271.  
  272.    branch ::=        concat
  273.         or  concat \& concat
  274.         or  concat \& concat \& concat
  275.         etc.
  276.  
  277.                         */concat*
  278. 3. A concat is one or more pieces, concatenated.  It matches a match for the
  279.    first piece, followed by a match for the second piece, etc.  Example:
  280.    "f[0-9]b", first matches "f", then a digit and then "b".
  281.  
  282.    concat  ::=        piece
  283.         or  piece piece
  284.         or  piece piece piece
  285.         etc.
  286.  
  287.                         */piece*
  288. 4. A piece is an atom, possibly followed by a multi, an indication of how many
  289.    times the atom can be matched.  Example: "a*" matches any sequence of "a"
  290.    characters: "", "a", "aa", etc.  See |/multi|.
  291.  
  292.    piece   ::=        atom
  293.         or  atom  multi
  294.  
  295.                         */atom*
  296. 5. An atom can be one of a long list of items.  Each atom matches a certain
  297.    character.  It is often an ordinary character or a character class.  Braces
  298.    can be used to make a pattern into an atom.  The "\z(\)" construct is only
  299.    for syntax highlighting.
  300.  
  301.    atom    ::=        ordinary-atom        |/ordinary-atom|
  302.         or  \( pattern \)        |/\(|
  303.         or  \%( pattern \)        |/\%(|
  304.         or  \z( pattern \)        |/\z(|
  305.  
  306.  
  307. Overview of multi items.                */multi* *E61* *E62*
  308. More explanation and examples below, follow the links.            *E64*
  309.  
  310.       multi ~
  311.      'magic' 'nomagic'    matches of the preceding atom ~
  312. |/star|    *    \*    0 or more    as many as possible
  313. |/\+|    \+    \+    1 or more    as many as possible (*)
  314. |/\=|    \=    \=    0 or 1        as many as possible (*)
  315. |/\?|    \?    \?    0 or 1        as many as possible (*)
  316.  
  317. |/\{|    \{n,m}    \{n,m}    n to m        as many as possible (*)
  318.     \{n}    \{n}    n        exactly (*)
  319.     \{n,}    \{n,}    at least n    as many as possible (*)
  320.     \{,m}    \{,m}    0 to m        as many as possible (*)
  321.     \{}    \{}    0 or more    as many as possible (same as *) (*)
  322.  
  323. |/\{-|    \{-n,m}    \{-n,m}    n to m        as few as possible (*)
  324.     \{-n}    \{-n}    n        exactly (*)
  325.     \{-n,}    \{-n,}    at least n    as few as possible (*)
  326.     \{-,m}    \{-,m}    0 to m        as few as possible (*)
  327.     \{-}    \{-}    0 or more    as few as possible (*)
  328.  
  329.                             *E59*
  330. |/\@>|    \@>    \@>    1, like matching a whole pattern (*)
  331. |/\@=|    \@=    \@=    nothing, requires a match |/zero-width| (*)
  332. |/\@!|    \@!    \@!    nothing, requires NO match |/zero-width| (*)
  333. |/\@<=|    \@<=    \@<=    nothing, requires a match behind |/zero-width| (*)
  334. |/\@<!|    \@<!    \@<!    nothing, requires NO match behind |/zero-width| (*)
  335.  
  336. (*) {not in Vi}
  337.  
  338.  
  339. Overview of ordinary atoms.                */ordinary-atom*
  340. More explanation and examples below, follow the links.
  341.  
  342.       ordinary atom ~
  343.       magic   nomagic    matches ~
  344. |/^|    ^    ^    start-of-line (at start of pattern) |/zero-width|
  345. |/\^|    \^    \^    literal '^'
  346. |/\_^|    \_^    \_^    start-of-line (used anywhere) |/zero-width|
  347. |/$|    $    $    end-of-line (at end of pattern) |/zero-width|
  348. |/\$|    \$    \$    literal '$'
  349. |/\_$|    \_$    \_$    end-of-line (used anywhere) |/zero-width|
  350. |/.|    .    \.    any single character (not an end-of-line)
  351. |/\_.|    \_.    \_.    any single character or end-of-line
  352. |/\<|    \<    \<    beginning of a word |/zero-width|
  353. |/\>|    \>    \>    end of a word |/zero-width|
  354. |/\zs|    \zs    \zs    anything, sets start of match
  355. |/\ze|    \ze    \ze    anything, sets end of match
  356. |/\%^|    \%^    \%^    beginning of file |/zero-width|        *E71*
  357. |/\%$|    \%$    \%$    end of file |/zero-width|
  358. |/\%#|    \%#    \%#    cursor position |/zero-width|
  359. |/\%l|    \%23l    \%23l    line number |/zero-width|
  360. |/\%c|    \%23c    \%23c    column number |/zero-width|
  361. |/\%v|    \%23v    \%23v    virtual column number |/zero-width|
  362.  
  363. Character classes {not in Vi}:
  364. |/\i|    \i    \i    identifier character (see 'isident' option)
  365. |/\I|    \I    \I    like "\i", but excluding digits
  366. |/\k|    \k    \k    keyword character (see 'iskeyword' option)
  367. |/\K|    \K    \K    like "\k", but excluding digits
  368. |/\f|    \f    \f    file name character (see 'isfname' option)
  369. |/\F|    \F    \F    like "\f", but excluding digits
  370. |/\p|    \p    \p    printable character (see 'isprint' option)
  371. |/\P|    \P    \P    like "\p", but excluding digits
  372. |/\s|    \s    \s    whitespace character: <Space> and <Tab>
  373. |/\S|    \S    \S    non-whitespace character; opposite of \s
  374. |/\d|    \d    \d    digit:                [0-9]
  375. |/\D|    \D    \D    non-digit:            [^0-9]
  376. |/\x|    \x    \x    hex digit:            [0-9A-Fa-f]
  377. |/\X|    \X    \X    non-hex digit:            [^0-9A-Fa-f]
  378. |/\o|    \o    \o    octal digit:            [0-7]
  379. |/\O|    \O    \O    non-octal digit:        [^0-7]
  380. |/\w|    \w    \w    word character:            [0-9A-Za-z_]
  381. |/\W|    \W    \W    non-word character:        [^0-9A-Za-z_]
  382. |/\h|    \h    \h    head of word character:        [A-Za-z_]
  383. |/\H|    \H    \H    non-head of word character:    [^A-Za-z_]
  384. |/\a|    \a    \a    alphabetic character:        [A-Za-z]
  385. |/\A|    \A    \A    non-alphabetic character:    [^A-Za-z]
  386. |/\l|    \l    \l    lowercase character:        [a-z]
  387. |/\L|    \L    \L    non-lowercase character:    [^a-z]
  388. |/\u|    \u    \u    uppercase character:        [A-Z]
  389. |/\U|    \U    \U    non-uppercase character        [^A-Z]
  390. |/\_|    \_x    \_x    where x is any of the characters above: character
  391.             class with end-of-line included
  392. (end of character classes)
  393.  
  394. |/\e|    \e    \e    <Esc>
  395. |/\t|    \t    \t    <Tab>
  396. |/\r|    \r    \r    <CR>
  397. |/\b|    \b    \b    <BS>
  398. |/\n|    \n    \n    end-of-line
  399. |/~|    ~    \~    last given substitute string
  400. |/\1|    \1    \1    same string as matched by first \(\) {not in Vi}
  401. |/\2|    \2    \2    Like "\1", but uses second \(\)
  402.        ...
  403. |/\9|    \9    \9    Like "\1", but uses ninth \(\)
  404.                                 *E68*
  405. |/\z1|    \z1    \z1    only for syntax highlighting, see |:syn-ext-match|
  406.        ...
  407. |/\z1|    \z9    \z9    only for syntax highlighting, see |:syn-ext-match|
  408.  
  409.     x    x    a character with no special meaning matches itself
  410.  
  411. |/[]|    []    \[]    any character specified inside the []
  412. |/\%[]| \%[]    \%[]    a list of optionally matched atoms
  413.  
  414. |/\c|    \c    \c    ignore case
  415. |/\C|    \C    \C    match case
  416. |/\m|    \m    \m    'magic' on for the following chars in the pattern
  417. |/\M|    \M    \M    'magic' off for the following chars in the pattern
  418. |/\v|    \v    \v    the following chars in the pattern are "very magic"
  419. |/\V|    \V    \V    the following chars in the pattern are "very nomagic"
  420.  
  421.  
  422. Example            matches ~
  423. \<\I\i*        or
  424. \<\h\w*
  425. \<[a-zA-Z_][a-zA-Z0-9_]*
  426.             An identifier (e.g., in a C program).
  427.  
  428. \(\.$\|\. \)        A period followed by <EOL> or a space.
  429.  
  430. [.!?][])"']*\($\|[ ]\)    A search pattern that finds the end of a sentence,
  431.             with almost the same definition as the ")" command.
  432.  
  433.  
  434. Magic                            */magic*
  435.  
  436. Some characters in the pattern are taken literally.  They match with the same
  437. character in the text.  When preceded with a backslash however, these
  438. characters get a special meaning.
  439.  
  440. Other characters have a special meaning without a backslash.  They need to be
  441. preceded with a backslash to match literally.
  442.  
  443. If a character is taken literally or not depends on the 'magic' option and the
  444. items mentioned next.
  445.                             */\m* */\M*
  446. Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
  447. ignoring the actual value of the 'magic' option.
  448. Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.
  449.                             */\v* */\V*
  450. Use of "\v" means that in the pattern after it all ASCII characters except
  451. '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning.  "very magic"
  452.  
  453. Use of "\V" means that in the pattern after it only the backslash has a
  454. special meaning.  "very nomagic"
  455.  
  456. Examples:
  457. after:      \v       \m        \M         \V        matches ~
  458.         'magic' 'nomagic'
  459.       $       $        $         \$        matches end-of-line
  460.       .       .        \.         \.        matches any character
  461.       *       *        \*         \*        any number of the previous atom
  462.       ()       \(\)     \(\)     \(\)    grouping into an atom
  463.       |       \|        \|         \|        separating alternatives
  464.       \a       \a        \a         \a        alphabetic character
  465.       \\       \\        \\         \\        literal backslash
  466.       \.       \.        .         .        literal dot
  467.       \{       {        {         {        literal '{'
  468.       a       a        a         a        literal 'a'
  469.  
  470. {only Vim supports \m, \M, \v and \V}
  471.  
  472. It is recommended to always keep the 'magic' option at the default setting,
  473. which is 'magic'.  This avoids portability problems.  To make a pattern immune
  474. to the 'magic' option being set or not, put "\m" or "\M" at the start of the
  475. pattern.
  476.  
  477.  
  478. Multi items
  479.  
  480. An atom can be followed by an indication of how many times the atom can be
  481. matched and in what way.  This is called a multi.  See |/multi| for an
  482. overview.
  483.  
  484. It is not possible to use a multi that can match more than one time after an
  485. atom that can match an empty string.  That's because this could result in an
  486. endless loop.  If you try it, you will get this error message: >
  487.     *, \+ or \{ operand could be empty
  488. <
  489.                         */star* */\star* *E56*
  490. *    (use \* with 'nomagic')
  491.     Matches 0 or more of the preceding atom, as many as possible.
  492.     Example  'nomagic'    matches ~
  493.     a*       a\*        "", "a", "aa", "aaa", etc.
  494.     .*       \.\*        anything, also an empty string, no end-of-line
  495.     \_.*       \_.\*    everything up to the end of the buffer
  496.     \_.*END       \_.\*END    everything up to and including the last "END"
  497.                 in the buffer
  498.  
  499.     Be aware that repeating "\_." can match a lot of text and take a long
  500.     time.  For example, "\_.*END" matches all text from the current
  501.     position to the last occurrence of "END" in the file.  Since the "*"
  502.     will match as many as possible, this first skips over all lines until
  503.     the end of the file and then tries matching "END", backing up one
  504.     character at a time.
  505.  
  506.                             */\+* *E57*
  507. \+    Matches 1 or more of the preceding atom, as many as possible. {not in
  508.     Vi}
  509.     Example        matches ~
  510.     ^.\+$        any non-empty line
  511.     \s\+        white space of at least one character
  512.  
  513.                             */\=*
  514. \=    Matches 0 or 1 of the preceding atom, as many as possible. {not in Vi}
  515.     Example        matches ~
  516.     foo\=        "fo" and "foo"
  517.  
  518.                             */\?*
  519. \?    Just like \=.  Cannot be used when searching backwards with the "?"
  520.     command. {not in Vi}
  521.  
  522.                             */\{* *E58* *E60*
  523. \{n,m}    Matches n to m of the preceding atom, as many as possible
  524. \{n}    Matches n of the preceding atom
  525. \{n,}    Matches at least n of the preceding atom, as many as possible
  526. \{,m}    Matches 0 to m of the preceding atom, as many as possible
  527. \{}    Matches 0 or more of the preceding atom, as many as possible (like *)
  528.                             */\{-*
  529. \{-n,m}    matches n to m of the preceding atom, as few as possible
  530. \{-n}    matches n of the preceding atom
  531. \{-n,}    matches at least n of the preceding atom, as few as possible
  532. \{-,m}    matches 0 to m of the preceding atom, as few as possible
  533. \{-}    matches 0 or more of the preceding atom, as few as possible
  534.     {Vi does not have any of these}
  535.  
  536.     n and m are positive decimal numbers
  537.  
  538.     If a "-" appears immediately after the "{", then a shortest match
  539.     first algorithm is used (see example below).  In particular, "\{-}" is
  540.     the same as "*" but uses the shortest match first algorithm.  BUT: A
  541.     match that starts earlier is preferred over a shorter match: "a\{-}b"
  542.     matches "aaab" in "xaaab".
  543.  
  544.     Example            matches ~
  545.     ab\{2,3}c        "abbc" or "abbbc"
  546.     a\{5}            "aaaaa".
  547.     ab\{2,}c        "abbc", "abbbc", "abbbbc", etc
  548.     ab\{,3}c        "ac", "abc", "abbc" or "abbbc".
  549.     a[bc]\{3}d        "abbbd", "abbcd", "acbcd", "acccd", etc.
  550.     a\(bc\)\{1,2}d        "abcd" or "abcbcd"
  551.     a[bc]\{-}[cd]        "abc" in "abcd"
  552.     a[bc]*[cd]        "abcd" in "abcd"
  553.  
  554.                             */\@=*
  555. \@=    Matches the preceding atom with zero width. {not in Vi}
  556.     Like '(?=pattern)" in Perl.
  557.     Example            matches ~
  558.     foo\(bar\)\@=        "foo" in "foobar"
  559.     foo\(bar\)\@=foo    nothing
  560.                             */zero-width*
  561.     When using "\@=" (or "^", "$", "\<", "\>") no characters are included
  562.     in the match.  These items are only used to check if a match can be
  563.     made.  This can be tricky, because a match with following items will
  564.     be done in the same position.  The last example above will not match
  565.     "foobarfoo", because it tries match "foo" in the same position where
  566.     "bar" matched.
  567.  
  568.     Note that using "\&" works exactly the same as using "\@=": "foo\&.."
  569.     is the same as "\(foo\)\@=..".  But using "\&" is easier.
  570.  
  571.  
  572.                             */\@!*
  573. \@!    Matches with zero width if the preceding atom does NOT match at the
  574.     current position |/zero-width| {not in Vi}
  575.     Like '(?!pattern)" in Perl.
  576.     Example            matches ~
  577.     foo\(bar\)\@!        any "foo" not followed by "bar"
  578.     a.\{-}p\@!        "a", "ap", "app", etc. not followed by a "p"
  579.  
  580.     Using "\@!" is tricky, because there are many places where a pattern
  581.     does not match.  "a.*p\@!" will match from an "a" to the end of the
  582.     line, because ".*" can match all characters in the line and the "p"
  583.     doesn't match at the end of the line.  "a.\{-}p\@!" will match any
  584.     "a", "ap", "aap", etc. that isn't followed by a "p", because the "."
  585.     can match a "p" and "p\@!" doesn't match after that.
  586.  
  587.     You can't use "\@!" to look for a non-match before the matching
  588.     position: "\(foo\)\@!bar" will match "bar" in "foobar", because at the
  589.     position where "bar" matches, "foo" does not match.  To avoid matching
  590.     "foobar" you could use "\(foo\)\@!...bar", but that doesn't match a
  591.     bar at the start of a line. Use "\(foo\)\@<!bar".
  592.  
  593.                             */\@<=*
  594. \@<=    Matches with zero width if the preceding atom matches just before what
  595.     follows. |/zero-width| {not in Vi}
  596.     Like '(?<=pattern)" in Perl, but Vim allows non-fixed-width patterns.
  597.     Example            matches ~
  598.     \(an\_s\+\)\@<=file    "file" after "an" and white space or a
  599.                 end-of-line
  600.  
  601.     "\@<=" and "\@<!" check for matches just before what follows.
  602.     Theoretically these matches could start anywhere before this position.
  603.     But to limit the time needed, only the line where what follows matches
  604.     is searched, and one line before that (if there is one).  This should
  605.     be sufficient to match most things and not be too slow.
  606.  
  607.                             */\@<!*
  608. \@<!    Matches with zero width if the preceding atom does NOT match just
  609.     before what follows. |/zero-width| {not in Vi}
  610.     Like '(?<!pattern)" in Perl, but Vim allows non-fixed-width patterns.
  611.     The match with the preceding atom is made to end just before the match
  612.     with what follows, thus an atom that ends in ".*" will work.
  613.     Example            matches ~
  614.     \(foo\)\@<!bar        any "bar" that's not in "foobar"
  615.     \(\/\/.*\)\@\<!in    "in" which is not after "//"
  616.  
  617.                             */\@>*
  618. \@>    Matches the preceding atom like matching a whole pattern. {not in Vi}
  619.     Like '(?>pattern)" in Perl.
  620.     Example        matches ~
  621.     \(a*\)\@>a    nothing (the "a*" takes all the "a"'s, there can't be
  622.             another one following)
  623.  
  624.     This matches the preceding atom as if it was a pattern by itself.  If
  625.     it doesn't match, there is no retry with shorter sub-matches or
  626.     anything.  Observe this difference: "a*b" and "a*ab" both match
  627.     "aaab", but in the second case the "a*" matches only the first two
  628.     "a"s.  "\(a*\)\@>ab" will not match "aaab", because the "a*" matches
  629.     the "aaa" (as many "a"s as possible), thus the "ab" can't match.
  630.  
  631.  
  632. An ordinary atom can be:
  633.  
  634.                             */^*
  635. ^    At beginning of pattern or after "\|", "\(", "\%(" or "\n": matches
  636.     start-of-line; at other positions, matches literal '^'. |/zero-width|
  637.     Example        matches ~
  638.     ^beep(        the start of the C function "beep" (probably).
  639.  
  640.                             */\^*
  641. \^    At any position, matches literal '^'.
  642.  
  643.                             */\_^*
  644. \_^    At any position, matches start-of-line. |/zero-width|
  645.     Example        matches ~
  646.     \_s*\_^foo    white space and blank lines and then "foo" at
  647.             start-of-line
  648.  
  649.                             */$*
  650. $    At end of pattern or in front of "\|" or "\)": matches end-of-line
  651.     <EOL>; at other positions, matches literal '$'. |/zero-width|
  652.  
  653.                             */\$*
  654. \$    At any position, matches literal '$'.
  655.  
  656.                             */\_$*
  657. \_$    At any position, matches end-of-line. |/zero-width|
  658.     Example        matches ~
  659.     foo\_$\_s*    "foo" at end-of-line and following white space and
  660.             blank lines
  661.  
  662. .    (with 'nomagic': \.)                */.* */\.*
  663.     Matches any single character, but not an end-of-line.
  664.  
  665.                             */\_.*
  666. \_.    Matches any single character or end-of-line.
  667.     Careful: "\_.*" matches all text to the end of the buffer!
  668.  
  669.                             */\<*
  670. \<    Matches the beginning of a word: The next char is the first char of a
  671.     word.  The 'iskeyword' option specifies what is a word character.
  672.     |/zero-width|
  673.  
  674.                             */\>*
  675. \>    Matches the end of a word: The previous char is the last char of a
  676.     word. The 'iskeyword' option specifies what is a word character.
  677.     |/zero-width|
  678.  
  679.                             */\zs*
  680. \zs    Matches at any position, and sets the start of the match there: The
  681.     next char is the first char of the whole match. |/zero-width|
  682.     Can be used multiple times, the last one encountered in a matching
  683.     branch is used.
  684.     Example: "^\s*\zsif" matches an "if" at the start of a line, ignoring
  685.     white space.
  686.     {not in Vi} {not available when compiled without the +syntax feature}
  687.                             */\ze*
  688. \ze    Matches at any position, and sets the end of the match there: The
  689.     previous char is the last char of the whole match. |/zero-width|
  690.     Can be used multiple times, the last one encountered in a matching
  691.     branch is used.
  692.     Example: "end\ze\(if\|for\)" matches the "end" in "endif" and
  693.     "endfor".
  694.     {not in Vi} {not available when compiled without the +syntax feature}
  695.  
  696.                         */\%^* *start-of-file*
  697. \%^    Matches start of the file.  When matching with a string, matches the
  698.     start of the string. {not in Vi}
  699.     For example, to find the first "VIM" in a file: >
  700.         /\%^\_.\{-}\zsVIM
  701. <
  702.                         */\%$* *end-of-file*
  703. \%$    Matches end of the file.  When matching with a string, matches the
  704.     end of the string. {not in Vi}
  705.     Note that this does NOT find the last "VIM" in a file: >
  706.         /VIM\_.\{-}\%$
  707. <    It will find the next VIM, because the part after it will always
  708.     match.  This one will find the last "VIM" in the file: >
  709.         /VIM\ze\(\(VIM\)\@!\_.\)*\%$
  710. <    This uses |/\@!| to ascertain that "VIM" does NOT match in any
  711.     position after the first "VIM".
  712.     Searching from the end of the file backwards is easier!
  713.  
  714.                         */\%#* *cursor-position*
  715. \%#    Matches with the cursor position.  Only works when matching in a
  716.     buffer displayed in a window. {not in Vi}
  717.     WARNING: When the cursor is moved after the pattern was used, the
  718.     result becomes invalid.  Vim doesn't automatically update the matches.
  719.     This is especially relevant for syntax highlighting and 'hlsearch'.
  720.     In other words: When the cursor moves the display isn't updated for
  721.     this change.  An update is done for lines which are changed (the whole
  722.     line is updated) or when using the |CTRL-L| command (the whole screen
  723.     is updated).  Example, to highlight the word under the cursor: >
  724.         /\k*\%#\k*
  725. <    When 'hlsearch' is set and you move the cursor around and make changes
  726.     this will clearly show when the match is updated or not.
  727.  
  728.                         */\%l* */\%>l* */\%<l*
  729. \%23l    Matches in a specific line.
  730. \%<23l    Matches above a specific line.
  731. \%>23l    Matches below a specific line.
  732.     These three can be used to match specific lines in a buffer.  The "23"
  733.     can be any line number.  The first line is 1. {not in Vi}
  734.     WARNING: When inserting or deleting lines Vim does not automatically
  735.     update the matches.  This means Syntax highlighting quickly becomes
  736.     wrong.
  737.     Example, to highlight the line where the cursor currently is: >
  738.         :exe '/\%' . line(".") . 'l.*'
  739. <    When 'hlsearch' is set and you move the cursor around and make changes
  740.     this will clearly show when the match is updated or not.
  741.  
  742.                         */\%c* */\%>c* */\%<c*
  743. \%23c    Matches in a specific column.
  744. \%<23c    Matches before a specific column.
  745. \%>23c    Matches after a specific column.
  746.     These three can be used to match specific columns in a buffer or
  747.     string.  The "23" can be any column number.  The first column is 1.
  748.     Actually, the column is the byte number (thus it's not exactly right
  749.     for multi-byte characters).  {not in Vi}
  750.     WARNING: When inserting or deleting text Vim does not automatically
  751.     update the matches.  This means Syntax highlighting quickly becomes
  752.     wrong.
  753.     Example, to highlight the column where the cursor currently is: >
  754.         :exe '/\%' . col(".") . 'c'
  755. <    When 'hlsearch' is set and you move the cursor around and make changes
  756.     this will clearly show when the match is updated or not.
  757.  
  758.                         */\%v* */\%>v* */\%<v*
  759. \%23v    Matches in a specific virtual column.
  760. \%<23v    Matches before a specific virtual column.
  761. \%>23v    Matches after a specific virtual column.
  762.     These three can be used to match specific virtual columns in a buffer
  763.     or string.  When not matching with a buffer in a window, the option
  764.     values of the current window are used (e.g., 'tabstop').
  765.     The "23" can be any column number.  The first column is 1.
  766.     Note that some virtual column positions will never match, because they
  767.     are halfway a Tab or other character that occupies more than one
  768.     screen character.  {not in Vi}
  769.     WARNING: When inserting or deleting text Vim does not automatically
  770.     update the matches.  This means Syntax highlighting quickly becomes
  771.     wrong.
  772.     Example, to highlight the all characters after virtual column 72: >
  773.         /\%>72v.*
  774. <    When 'hlsearch' is set and you move the cursor around and make changes
  775.     this will clearly show when the match is updated or not.
  776.     To match the text up to column 17: >
  777.         /.*\%17v
  778. <    Column 17 is not included, because that's where the "\%17v" matches,
  779.     and since this is a |/zero-width| match, column 17 isn't included in
  780.     the match.  This does the same: >
  781.         /.*\%<18v
  782. <
  783.  
  784. Character classes: {not in Vi}
  785. \i    identifier character (see 'isident' option)    */\i*
  786. \I    like "\i", but excluding digits            */\I*
  787. \k    keyword character (see 'iskeyword' option)    */\k*
  788. \K    like "\k", but excluding digits            */\K*
  789. \f    file name character (see 'isfname' option)    */\f*
  790. \F    like "\f", but excluding digits            */\F*
  791. \p    printable character (see 'isprint' option)    */\p*
  792. \P    like "\p", but excluding digits            */\P*
  793.  
  794. NOTE: the above also work for multi-byte characters.  The ones below only
  795. match ASCII characters, as indicated by the range.
  796.  
  797.                         *whitespace* *white-space*
  798. \s    whitespace character: <Space> and <Tab>        */\s*
  799. \S    non-whitespace character; opposite of \s    */\S*
  800. \d    digit:                [0-9]        */\d*
  801. \D    non-digit:            [^0-9]        */\D*
  802. \x    hex digit:            [0-9A-Fa-f]    */\x*
  803. \X    non-hex digit:            [^0-9A-Fa-f]    */\X*
  804. \o    octal digit:            [0-7]        */\o*
  805. \O    non-octal digit:        [^0-7]        */\O*
  806. \w    word character:            [0-9A-Za-z_]    */\w*
  807. \W    non-word character:        [^0-9A-Za-z_]    */\W*
  808. \h    head of word character:        [A-Za-z_]    */\h*
  809. \H    non-head of word character:    [^A-Za-z_]    */\H*
  810. \a    alphabetic character:        [A-Za-z]    */\a*
  811. \A    non-alphabetic character:    [^A-Za-z]    */\A*
  812. \l    lowercase character:        [a-z]        */\l*
  813. \L    non-lowercase character:    [^a-z]        */\L*
  814. \u    uppercase character:        [A-Z]        */\u*
  815. \U    non-uppercase character        [^A-Z]        */\U*
  816.  
  817.     NOTE: Using the atom is faster than the [] form.
  818.  
  819.     NOTE: 'ignorecase', "\c" and "\C" are not used by character classes.
  820.  
  821.                             */\_* *E63*
  822. \_x    Where "x" is any of the characters above: The character class with
  823.     end-of-line added
  824. (end of character classes)
  825.  
  826. \e    matches <Esc>                    */\e*
  827. \t    matches <Tab>                    */\t*
  828. \r    matches <CR>                    */\r*
  829. \b    matches <BS>                    */\b*
  830. \n    matches a end-of-line                */\n*
  831.  
  832. ~    matches the last given substitute string    */~* */\~*
  833.  
  834. \(\)    A pattern enclosed by escaped parentheses    */\(* */\(\)* */\)*
  835.     (e.g., "\(^a\)") matches 'a' at the start of a line.  *E51* *E54* *E55*
  836.  
  837. \1      Matches the same string that was matched by    */\1* *E65*
  838.     the first sub-expression in \( and \). {not in Vi}
  839.     Example: "\([a-z]\).\1" matches "ata", "ehe", "tot", etc.
  840. \2      Like "\1", but uses second sub-expression,    */\2*
  841.    ...                            */\3*
  842. \9      Like "\1", but uses ninth sub-expression.    */\9*
  843.     Note: The numbering of groups is done based on which "\(" comes first
  844.     in the pattern (going left to right), NOT based on what is matched
  845.     first.
  846.  
  847. \%(\)    A pattern enclosed by escaped parentheses.    */\%(\)* */\%(* *E53*
  848.     Just like \(\), but without counting it as a sub-expression
  849.     {not in Vi}
  850.  
  851. x    A single character, with no special meaning, matches itself
  852.  
  853.                             */\* */\\*
  854. \x    A backslash followed by a single character, with no special meaning,
  855.     is reserved for future expansions
  856.  
  857. []    (with 'nomagic': \[])        */[]* */\[]* */\_[]* */collection*
  858. \_[]
  859.     A collection. This is a sequence of characters enclosed in brackets.
  860.     It matches any single character in the collection.
  861.     Example        matches ~
  862.     [xyz]        any 'x', 'y' or 'z'
  863.     [a-zA-Z]$    any alphabetic character at the end of a line
  864.     \c[a-z]$    same
  865.  
  866.     With "\_" prepended the collection also includes the end-of-line.
  867.     The same can be done by including "\n" in the collection.  The
  868.     end-of-line is also matched when the collection starts with "^"!  Thus
  869.     "\_[^ab]" matches the end-of-line and any character but "a" and "b".
  870.     This makes it Vi compatible: Without the "\_" or "\n" the collection
  871.     does not match an end-of-line.
  872.  
  873.     If the sequence begins with "^", it matches any single character NOT
  874.     in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'.
  875.     - If two characters in the sequence are separated by '-', this is
  876.       shorthand for the full list of ASCII characters between them.  E.g.,
  877.       "[0-9]" matches any decimal digit.
  878.     - A character class expression is evaluated to the set of characters
  879.       belonging to that character class.  The following character classes
  880.       are supported:
  881.               Name        Contents ~
  882. *[:alnum:]*          [:alnum:]     letters and digits
  883. *[:alpha:]*          [:alpha:]     letters
  884. *[:blank:]*          [:blank:]     space and tab characters
  885. *[:cntrl:]*          [:cntrl:]     control characters
  886. *[:digit:]*          [:digit:]     decimal digits
  887. *[:graph:]*          [:graph:]     printable characters excluding space
  888. *[:lower:]*          [:lower:]     lowercase letters (all letters when
  889.                     'ignorecase' is used)
  890. *[:print:]*          [:print:]     printable characters including space
  891. *[:punct:]*          [:punct:]     punctuation characters
  892. *[:space:]*          [:space:]     whitespace characters
  893. *[:upper:]*          [:upper:]     uppercase letters (all letters when
  894.                     'ignorecase' is used)
  895. *[:xdigit:]*          [:xdigit:]    hexadecimal digits
  896. *[:return:]*          [:return:]    the <CR> character
  897. *[:tab:]*          [:tab:]    the <Tab> character
  898. *[:escape:]*          [:escape:]    the <Esc> character
  899. *[:backspace:]*          [:backspace:]    the <BS> character
  900.       The brackets in character class expressions are additional to the
  901.       brackets delimiting a collection.  For example, the following is a
  902.       plausible pattern for a UNIX filename: "[-./[:alnum:]_~]\+" That is,
  903.       a list of at least one character, each of which is either '-', '.',
  904.       '/', alphabetic, numeric, '_' or '~'.
  905.       These items only work for 8-bit characters.
  906.                               */\]*
  907.     - To include a literal ']', '^', '-' or '\' in the collection, put a
  908.       backslash before it: "[xyz\]]", "[\^xyz]", "[xy\-z]" and "[xyz\\]".
  909.       (Note: POSIX does not support the use of a backslash this way).  For
  910.       ']' you can also make it the first character (following a possible
  911.       "^"):  "[]xyz]" or "[^]xyz]" {not in Vi}.
  912.       For '-' you can also make it the first or last character: "[-xyz]",
  913.       "[^-xyz]" or "[xyz-]".  For '\' you can also let it be followed by
  914.       any character that's not in "^]-\bertn".  "[\xyz]" matches '\', 'x',
  915.       'y' and 'z'.  It's better to use "\\" though, future expansions may
  916.       use other characters after '\'.
  917.     - The following translations are accepted when the 'l' flag is not
  918.       included in 'cpoptions' {not in Vi}:
  919.         \e    <Esc>
  920.         \t    <Tab>
  921.         \r    <CR>    (NOT end-of-line!)
  922.         \b    <BS>
  923.       NOTE: The other backslash codes mentioned above do not work inside
  924.       []!
  925.     - Matching with a collection can be slow, because each character in
  926.       the text has to be compared with each character in the collection.
  927.       Use one of the other atoms above when possible.  Example: "\d" is
  928.       much faster than "[0-9]" and matches the same characters.
  929.  
  930.                         */\%[]* *E69* *E70*
  931. \%[]    A list of optionally matched atoms.  This always matches.
  932.     It matches as much of the list of atoms it contains as possible.  Thus
  933.     it stops at the first atom that doesn't match.  For example: >
  934.         /r\%[ead]
  935. <    matches "r", "re", "rea" or "read".  The longest that matches is used.
  936.     To match the Ex command "function", where "fu" is required and
  937.     "nction" is optional, this would work: >
  938.         /\<fu\%[nction]\>
  939. <    The end-of-word atom "\>" is used to avoid matching "fu" in "full".
  940.     It gets more complicated when the atoms are not ordinary characters.
  941.     You don't often have to use it, but it is possible.  Example: >
  942.         /\<r\%[[eo]ad]\>
  943. <    Matches the words "r", "re", "ro", "rea", "roa", "read" and "road".
  944.     {not available when compiled without the +syntax feature}
  945.  
  946.  
  947. Ignoring case in a pattern                    */ignorecase*
  948.  
  949. If the 'ignorecase' option is on, the case of normal letters is ignored.
  950. 'smartcase' can be set to ignore case when the pattern contains lowercase
  951. letters only.
  952.                             */\c* */\C*
  953. When "\c" appears anywhere in the pattern, the whole pattern is handled like
  954. 'ignorecase' is on.  The actual value of 'ignorecase' and 'smartcase' is
  955. ignored.  "\C" does the opposite: Force matching case for the whole pattern.
  956. {only Vim supports \c and \C}
  957. Note that 'ignorecase', "\c" and "\C" are not used for the character classes.
  958.  
  959. Examples:
  960.       pattern    'ignorecase'  'smartcase'    matches ~
  961.     foo      off        -        foo
  962.     foo      on        -        foo Foo FOO
  963.     Foo      on        off        foo Foo FOO
  964.     Foo      on        on            Foo
  965.     \cfoo      -        -        foo Foo FOO
  966.     foo\C      -        -        foo
  967.  
  968.  
  969. Technical detail:                *NL-used-for-Nul*
  970. <Nul> characters in the file are stored as <NL> in memory.  In the display
  971. they are shown as "^@".  The translation is done when reading and writing
  972. files.  To match a <Nul> with a search pattern you can just enter CTRL-@ or
  973. "CTRL-V 000".  This is probably just what you expect.  Internally the
  974. character is replaced with a <NL> in the search pattern.  What is unusual is
  975. that typing CTRL-V CTRL-J also inserts a <NL>, thus also searches for a <Nul>
  976. in the file.  {Vi cannot handle <Nul> characters in the file at all}
  977.  
  978.                         *CR-used-for-NL*
  979. When 'fileformat' is "mac", <NL> characters in the file are stored as <CR>
  980. characters internally.  In the display they are shown as "^M".  Otherwise this
  981. works similar to the usage of <NL> for a <Nul>.
  982.  
  983. When working with expression evaluation, a <NL> character in the pattern
  984. matches a <NL> in the string.  The use of "\n" (backslash n) to match a <NL>
  985. doesn't work there, it only works to match text in the buffer.
  986.  
  987. ==============================================================================
  988. 3. Highlighting matches                    *match-highlight*
  989.  
  990.                             *:mat* *:match*
  991. :mat[ch] {group} /{pattern}/
  992.         Define a pattern to highlight in the current window.  It will
  993.         be highlighted with {group}.  Example: >
  994.             :highlight MyGroup ctermbg=green guibg=green
  995.             :match MyGroup /TODO/
  996. <        Instead of // any character can be used to mark the start and
  997.         end of the {pattern}.
  998.         {group} must exist at the moment this command is executed.
  999.         The match overrides the 'hlsearch' highlighting.
  1000.         'ignorecase' does not apply, use |/\c| in the pattern to
  1001.         ignore case.  Otherwise case is not ignored.
  1002.         Note that highlighting the last used search pattern with
  1003.         'hlsearch' is used in all windows, while the pattern defined
  1004.         with ":match" only exists in the current window.  It is kept
  1005.         when switching to another buffer.
  1006.         Another example, which highlights all characters in virtual
  1007.         column 72 and more: >
  1008.             :highlight rightMargin term=bold ctermfg=blue guifg=blue
  1009.             :match rightMargin /.\%>72v/
  1010. <        To highlight all character that are in virtual column 7: >
  1011.             :highlight col8 ctermbg=grey guibg=grey
  1012.             :match col8 /\%<8v.\%>7v/
  1013. <        Note the use of two items to also match a character that
  1014.         occupies more than one virtual column, such as a TAB.
  1015.  
  1016. :mat[ch]
  1017. :mat[ch] none
  1018.         Clear a previously defined match pattern.
  1019.  
  1020.  vim:tw=78:ts=8:ft=help:norl:
  1021.